// Copyright (C) joyinter
// All rights reserved.
// 
// Author : Jiang Li
// Date   : 2004-12-17

#include "stdafx.h"
#include "svr_tmqueue.h"
#include "svr_server.h"

namespace JoyServer
{

// class CJoyTmQueue

CJoyTmQueue::CJoyTmQueue()
{
}

CJoyTmQueue::~CJoyTmQueue()
{
}

CJoyAsyncQueue* CJoyTmQueue::AllocAsyncQueue()
{
    return new CJoyAsyncQueue();
}

bool CJoyTmQueue::Create(CJoyServer* pServer, DWORD dwElapse)
{
    m_server    = pServer;

    m_asyncQueue = AllocAsyncQueue();
    if(!m_asyncQueue->Create(pServer->m_asyncExec))
    {
        return false;
    }

    if(!__super::Create(&pServer->m_timer, dwElapse))
    {
        return false;
    }

    return true;
}

void CJoyTmQueue::Destroy()
{
    __super::Destroy();

    if(m_asyncQueue != NULL)
    {
        m_asyncQueue->Destroy();
        m_asyncQueue->Release();
        m_asyncQueue = NULL;
    }
}


} // namespace JoyServer